const joi = require("joi");

const id = joi.required();
const name = joi
  .string()
  .pattern(/^([a-zA-Z0-9\u4e00-\u9fa5\·]{1,10})$/)
  .required();
const email = joi
  .string()
  .pattern(
    /^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})$/
  );
const oldPassword = joi
  .string()
  .pattern(/^(?=.*[^0-9].*)[\S]{1,50}$/)
  .min(6)
  .max(12);
const newPassword = joi
  .string()
  .pattern(/^(?=.*[^0-9].*)[\S]{1,50}$/)
  .min(6)
  .max(12);
const twoPassword = joi
  .string()
  .pattern(/^(?=.*[^0-9].*)[\S]{1,50}$/)
  .min(6)
  .max(12);
const account = joi.string().alphanum().min(6).max(12).required();

exports.changePwd = {
  body: {
    account,
    newPassword,
    twoPassword,
  },
};
exports.verifyAccountAndEmail = {
  body: {
    email,
    account,
  },
};
exports.pwd_limit = {
  body: {
    account,
    oldPassword,
    newPassword,
    twoPassword,
  },
};
// exports.user_limit = {
//   //对req.body里面数据进行验证
//   body: {
//     id,
//     name,
//     email,
//   },
// };
